package com.jt.Service;

import com.jt.Mapper.UserMapper;
import com.jt.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("target")
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public void add2(User user) {
        userMapper.add(user);

//        try{
//            System.out.println("事务开始");
//            userMapper.add(user);
//            System.out.println("事务结束");
//        }catch ( Exception e){
//            e.printStackTrace();
//            System.out.println("事务回滚");
//        }
    }

    @Override
    public void deleteUser(User user) {
        userMapper.deleteUser(user);
    }
}
